#ifndef _LA_LIST_H
#define _LA_LIST_H

#define LA_OFFSET_OF(ptr, type, member) (\
  (unsigned long)( &( (type *)0 )->member )\
)

#define LA_CONTAINER_OF(ptr, type, member) (\
  (type *)( (unsigned char *)(ptr) - LA_OFFSET_OF(ptr, type, member) )\
)

#define LA_LIST_ADD(list, node, next) {\
  (node)->next = (list)->next;\
  (list)->next = (node);\
}

#define LA_LIST_DEL(list, next) {\
  if ((list)->next) {\
    (list)->next = (list)->next->next;\
  }\
}

#endif
